Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(neon): Improve ValueInternal safety #1081

Merged
merged 1 commit into from
Oct 25, 2024
Merged

Conversation

kjvalencik
Copy link
Member

@kjvalencik kjvalencik commented Oct 11, 2024

ValueInternal::is_typeof and ValueInternal::downcast accept raw Env, but can trivially accept Cx instead.

This will allow for global type wrappers (e.g., #1080) that can type check without any unsafe code.

ValueInternal::is_typeof and ValueInternal::downcast accept raw `Env`, but can trivially accept `Cx` instead.
@@ -31,13 +34,13 @@ pub(crate) unsafe fn prepare_call<'a, 'b, C: Context<'a>>(
pub trait ValueInternal: TransparentNoCopyWrapper + 'static {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ValueInternal::from_local could accept safe wrappers, but it would need to remain unsafe since it doesn't perform type checking.

Copy link
Collaborator

@dherman dherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice cleanup 👍

@kjvalencik kjvalencik merged commit ed60c50 into main Oct 25, 2024
9 checks passed
@kjvalencik kjvalencik deleted the kv/value-internal-safety branch October 25, 2024 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants